#include <ncurses.h>
#include <string>
using namespace std;

void start_ncurses(bool useRaw, bool useNoecho);
void printMenu(WINDOW* menu, string choices[], int size, int highlight);


int main(int argc , char** argv)
{
	initscr();
	noecho();
	cbreak();

	int y, x, yBeg, xBeg, yMax, xMax;
	getmaxyx(stdscr, yMax, xMax);

	WINDOW* win = newwin(6, xMax - 12, yMax - 8, 5);
	box(win, 0, 0);
	refresh();
	wrefresh(win);

	keypad(win, true);
	string choices[3] = {"walk", "jog", "run"};
	int choice;
	int highlight = 0;

	while (true) {
		for (int i = 0; i < 3; i++) {
			if (i == highlight)
				wattron(win, A_REVERSE);
			mvwprintw(win, i + 1, 1, choices[i].c_str());
			wattroff(win, A_REVERSE);
		}

		choice = wgetch(win);

		switch (choice) {
		case KEY_UP:
			highlight--;
			if (highlight == -1)
				highlight = 0;
			break;
		case KEY_DOWN:
			highlight++;
			if (highlight == 3)
				highlight = 2;
			break;
		default:
			break;
		}

		if (choice == 10)
			break;
	}

	printw("Your choice was: %s", choices[highlight].c_str());


	getch();

	endwin();
	

	return 0;
}
